home *** CD-ROM | disk | FTP | other *** search
- /* Figure 1 */
-
- EM_NAME DB 'EMMXXXX0', 0
-
- FIND_EM:
- ;Out: NC indicates expanded memory driver installed and functioning.
- ; BX = EM base segment if EMM installed
- ; C set if expanded memory can not be used.
- PUSH DS
- PUSH DX
- PUSH AX
- MOV AX, CS
- MOV DS, AX ;Use DOS open handle call to determine whether
- MOV DX, OFFSET EM_NAME ;EM driver is installed.
- MOV AH, 3DH ;Open handle function code.
- MOV AL, 0
- INT 21H ;Dos function.
- JC FE_00 ;C set if open fails.
- MOV BX, AX ;Device handle
- MOV AH, 44H ;IOCTL call
- MOV AL, 0 ;Device info subfunction
- MOV DX, 0
- INT 21H ;Call DOS
- JC FE_00 ;Exit, C set if error
- TEST DL, 80H ;Is it a device?
- STC
- JZ FE_00 ;Exit with C set if not device.
- MOV AH, 44H ;DOS IOCTL call
- MOV AL, 7 ;Output status
- INT 21H
- JC FE_00 ;Exit, C set if error.
- OR AL, AL ;Is it ready?
- STC
- JZ FE_00 ;Error exit if not.
- MOV AH, 3EH ;Close handle
- INT 21H
- JC FE_00
- MOV AH, 41H ;Get EM base address.
- INT EM_INT
- MOV EM_BASE, BX
- FE_00:
- POP AX
- POP DX
- POP DS
- RET
-